package com.hdax.dm.scheduler.mapstruct;

import com.hdax.dm.entity.scheduler.SchedulerSeat;
import com.hdax.dm.scheduler.dto.ChooseSeatScheduleDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Mapper(componentModel = "spring")
public abstract class SeatInfoDtoMapper {

    protected String turnToString(Long areaLevel){
        if(areaLevel == 1) return "A";
        if(areaLevel == 2) return "B";
        if(areaLevel == 3) return "C";
        return null;
    }

    @Mapping(target = "areaLevel", expression = "java(turnToString(source.getAreaLevel()))")
    public abstract ChooseSeatScheduleDto.SeatInfo toTarget(SchedulerSeat source);
    public abstract List<ChooseSeatScheduleDto.SeatInfo> toTargetList(List<SchedulerSeat> sources);
}